<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.knife.db.ComDAL" %>
<jsp:directive.page import="com.knife.blog.domain.BlogInfo"/>
<jsp:directive.page import="com.knife.blog.logic.BlogUserService"/>
<jsp:directive.page import="com.knife.blog.logic.impl.BlogUserServiceImpl"/>
<jsp:directive.page import="com.knife.review.BlogMessage"/>

<jsp:directive.page import="java.sql.ResultSet"/>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<%
String parameter=request.getParameter("parameter");
String mulitCid=request.getParameter("mulitCid");
mulitCid=mulitCid.substring(0,mulitCid.length()-1);
String[]cids= mulitCid.split(",");
String env="";
for(int i=0;i<cids.length;i++){
env+="'"+cids[i]+"',";
}
if(env.length()>0){
env=env.substring(0,env.length()-1);
}
if(parameter.equals("del")){
ComDAL dal=new ComDAL();
try{
dal.execCommand("delete from blogreview where cid in ("+env+")");
out.print("delete from blogreview where cid in ("+env+")");
dal.close();
response.sendRedirect("reviewManage.jsp");
}catch(Exception ex){
out.print("操作失败："+ex.getMessage());
dal.close();
}
}

if(parameter.equals("check")){
ComDAL dal=new ComDAL();
try{
	for(int i=0;i<cids.length;i++){
	//BlogMessage message=new BlogMessage().getObjectByID(Integer.valueOf(cids[i]));
	ResultSet rs=dal.DoSelect("select belonguser from blogmessage where cid='"+cids[i]+"'");
	if(rs!=null){
	String belonguser=rs.getString("belonguser");
	dal.execCommand("update  blogreview  set status=1 where cid='"+cids[i]+"'");
	BlogInfo blog;
	BlogUserService userService = BlogUserServiceImpl.getInstance();
	blog = userService.getUserBlog(belonguser);
	com.knife.blog.logic.HTMLGenerater.saveMessageToHTML(blog);
	com.knife.blog.logic.HTMLGenerater.saveToHTML(blog);
	}
  }
dal.close();
response.sendRedirect("reviewManage.jsp");
}catch(Exception ex){
out.print("操作失败："+ex.getMessage());
dal.close();
}
}
%>